<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="x1" style="height: 300px;background-color: pink;"></div>
    <button onclick="onResize()">重置尺寸</button>
    <script src="../js/echarts.min.js"></script>
    <script>
        //js 部分
        var myChart = echarts.init(x1);
        myChart.setOption({
            xAxis: {
                data: ["衬衫", "羊毛衫", "雪纺衫"]
            }, yAxis: {}, series: [{
                name: '销量', type: 'line', data: [5, 70, 36]
            }]
        });

        function onResize(){
            myChart.resize();
        }
        window.onresize=function(){
            myChart.resize();
        }
    </script>
</body>

</html>